<template>
  <!-- 建设验收审核 -->
  <div>
    <!-- 搜索 -->
    <TopFilter
      :list="topFilterInit"
      :cols="3"
      labelWidth="100"
      @filterChange="changeHandle"
      @onCollapse="collapseHandle"
    ></TopFilter>
     <!-- 经销商弹窗 -->
    <BaseDialog
      title="经销商查询"
      :visible.sync="visibleDealer"
      width="1000px"
      destroyOnClose
      :containerStyle="{height: 'calc(100% - 60px)', overflow: 'auto', paddingBottom: '60px'}"
    >
      <dealer-madal ref="addDialog" @close="closeDealer" />
    </BaseDialog>
  </div>
</template>
<script>
import dealerMadal from '../../../customerManage/clue/areaBossPush/dealerMadal';
import { dictionary } from '@/utils/dictMixin';
export default {
  mixins: [dictionary],
  components: {
    dealerMadal
  },
  data() {
    return {
      visibleDealer: false,
      topFilterInit: this.topFilterInitFun(),
    };
  },
  methods: {
    //搜索数据
    topFilterInitFun() {
      return [
        { type: 'SELECT', label: '经销商类型', fieldName: 'field2', placeholder: '请选择', initialValue: '', itemList: this.createDictList('1008') },
        {
          type: 'INPUT',
          label: '经销商',
          fieldName: 'field1',
          placeholder: '请选择',
          initialValue: '',
          unitRender: () => {
            return <el-button slot="append" icon="el-icon-search" onClick={() => this.dealerHandle()}></el-button>;
          }
        },
        { type: 'SELECT', label: '经销商级别', fieldName: 'field31', placeholder: '请选择', initialValue: '', itemList: this.createDictList('1008') },
        { type: 'SELECT', label: '事业部', fieldName: 'field3', placeholder: '请选择', initialValue: '', itemList: this.createDictList('1008') },
        { type: 'RANGE_DATE', label: '创建日期', fieldName: 'field22', valueFormat: 'yyyy-MM-dd', initialValue: '', placeholder: '请选择' },
        { type: 'SELECT', label: '经营状态', fieldName: 'JIanshe', placeholder: '请输入', initialValue: '', itemList: this.createDictList('1008') },
        { type: 'SELECT', label: '省份', fieldName: 'field4', placeholder: '请输入', initialValue: '', itemList: this.createDictList('1008') },
        { type: 'SELECT', label: '城市', fieldName: 'field5', placeholder: '请选择', initialValue: '', itemList: this.createDictList('1008') },
        { type: 'SELECT', label: '县区', fieldName: 'field6', placeholder: '请选择', initialValue: '', itemList: this.createDictList('1008') },
        { type: 'SELECT', label: '状态', fieldName: 'field7', placeholder: '请选择', initialValue: '', itemList: this.createDictList('1008') },
        { type: 'SELECT', label: '展厅级别', fieldName: 'field8', placeholder: '请选择', initialValue: '', itemList: this.createDictList('1008') },
        { type: 'SELECT', label: '售后级别', fieldName: 'field9', placeholder: '请选择', initialValue: '', itemList: this.createDictList('1008') }
      ];
    },
    //搜索获取数据
    changeHandle(val) {
      this.$emit('filterChange', val)
    },
    collapseHandle() {
      this.$emit('onCollapse', this.selectRow)
    },
    // 经销商打开窗口 -传数据
    dealerHandle() {
      this.visibleDealer = true;
    },
    // 经销商关闭窗口 -返回数据
    closeDealer(data) {
      //返回数据逻辑自己写
      this.topFilterInit[0].initialValue = '选择经销商';
      this.visibleDealer = data.visible; //关闭弹窗
    }
  }
};
</script>

<style lang="less" scoped>
</style>
